C
C *** LAST REVISED ON 16-MAR-1988 10:33:32.77
C *** SOURCE FILE: [DL.GRAPHICS.LONGLIB]REFIMG.FOR
C
	PROGRAM REFIMG
C
C	DISPLAY RAMTEK EMULATION FILE ONTO RAMTEK IMAGE SCREEN
C
C	WRITTEN: NOV 1986  DGL
C
C	THIS PROGRAM USES THE VAX FORTRAN "BYTE" VARIABLE TYPE
C
	CHARACTER*80 NAME
	BYTE B(1280)
C
	WRITE (*,1)
1	FORMAT('$Enter Ramtek Emulation File Name: ')
	READ(*,2) NAME
2	FORMAT(A80)
C
	IXWIDE=1280		! LARGE RAMTEK
	IYWIDE=1024
C
C	OPEN RAMTEK CHANNEL AND INITIALIZE RAMTEK
C
	CALL RAMOPEN(IC,1,IDDEV,IERR)
	CALL RMWIND(IC,0,0,1279,1023,IERR)
	CALL RMDIR(IC,0,IERR)
	CALL RMSTART(IC,0,0,IERR)
C
C	OPEN FILE
C
	IXW=1280
	IF (IXWIDE.EQ.512) IXW=512
	OPEN(UNIT=2,FILE=NAME,ACCESS='DIRECT',STATUS='OLD',
     $	 RECL=IXW,MAXREC=IYWIDE,FORM='FORMATTED',ERR=99)
C
C	READ FILE AND WRITE TO RAMTEK
C
	DO 250 IY=1,IYWIDE
		IF (MOD(IY,64).EQ.1) WRITE(*,240) IY
240		FORMAT('+Line ',I4)
		IF (IXW.EQ.512) THEN
			READ(2'IY,260) (B(II),II=1,512)
260			FORMAT(512A1)
		ELSE
			READ(2'IY,261) B
261			FORMAT(1280A1)
		ENDIF
		CALL RMWRITEBYTE(IC,B,IXWIDE,IERR)
250	CONTINUE
C
	STOP
C
99	WRITE(*,98)
98	FORMAT(' *** ERROR OPENING RAMTEK EMULATION FILE ***')
	STOP
	END
